package com.xmall.controller.wx;

import com.xmall.bean.vo.BaseRespVo;
import com.xmall.bean.vo.MallCommentVO;
import com.xmall.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author Connor
 * @ClassName: CommentController
 * @PackageName: com.xmall.controller.wx
 * @date 2020/12/10
 * @Version 1.0
 */
// @RestController("wxCommentController")
@RequestMapping("wx/comment")
public class CommentController {

    @Autowired
    CommentService commentService;

    @GetMapping("count")
    public BaseRespVo countComment(Integer valueId, Byte type) {
        Map<String, Long> map = commentService.countComment(valueId, type);
        return BaseRespVo.ok(map);
    }

    @GetMapping("list")
    public BaseRespVo listComment(Map<String, String> map) {
        MallCommentVO mallCommentVO = commentService.listComment(map);
        return BaseRespVo.ok(mallCommentVO);
    }
}
